Using networksetup
The command-line tool networksetup is used to configure a client's network settings. You can use it to create or modify network locations, change IP addresses, set network service proxies, and much more. You can find the command-line syntax, explanations, and an example in the tool's help prompt by entering the following line in Terminal:
- For Mac OS X 10.3 clients use the following:
- /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/networksetup -help
- For clients with Mac OS X v.10.4 or later, use the following from Send UNIX Command:
- networksetup -help
A few of the capabilities of networksetup are listed below.
| flag | description |
|---|---|
| -listallnetworkservices | Displays a list of all the network services on the server's hardware ports. An asterisk (*) denotes that a network service is disabled. |
| -setmanual networkservice ip subnet router | Set the TCP/IP configuration for network service to manual with IP address set to ip, Subnet Mask set to subnet, and Router address set to router. Example:networksetup -setmanual "Built-in Ethernet" 192.168.100.100 255.255.255.0 192.168.100.1 |
| -setdhcp networkservice [clientid] | Use this command to set the TCP/IP configuration for the specified network service to use DHCP. The client ID is optional. Specify "Empty" for [clientid] to clear the DHCP client id. Example:networksetup -setdhcp "Built-in Ethernet" |
| -setbootp networkservice | Use this command to set the TCP/IP configuration for the specified network service to use BOOTP.networksetup -setbootp "Built-in Ethernet" |
| -setmanualwithdhcprouter networkservice ip | Use this command to specify a manual IP address to use for DHCP for the specified network service. Example:networksetup -setmanualwithdhcprouter "Built-in Ethernet" 192.168.100.120 |
| -setdnsservers networkservice dns1 [dns2] | Use this command to specify the IP addresses of servers you want the specified network service to use to resolve domain names. You can list any number of servers (replace dns1, dns2, and so on with the IP addresses of domain name servers). If you want to clear all DNS entries for the specified network service, type "empty" in place of the DNS server names. Example:networksetup -setdnsservers "Built-in Ethernet" 192.168.100.100 192.168.100.12 |
| -setsearchdomains networkservice domain1 [domain2] | Use this command to designate the search domain for the specified network service. You can list any number of search domains (replace domain1, domain2, and so on with the name of a local domain). If you want to clear all search domain entries for the specified network service, type "empty" in place of the domain name. Example:networksetup -setsearchdomains "Built-in Ethernet" company.com corp.com |
| -setwebproxy networkservice domain portnumber (on | off) [username password] | Set Web proxy for a network service with domain and port number. Turns proxy on. Optionally, specify on or off to enable and disable authenticated proxy support. Specify username and password if you turn authenticated proxy support on. Example:networksetup -setwebproxy "Built-In Ethernet" proxy.company.com 80 on bob mypassword |
| -help | Displays a list of all the commands available in the Network Setup Tool, with explanatory information. |
Any command in the Mac OS X Server command-line guide which uses networksetup can be used in Remote Desktop using the Send UNIX Command task.
The command line guide can be found at: